<?php
	/* developer	: BREEZEER
	 * date			: 2023/4/20
	 * description	:
	 *				1. 映射 excel 文件列头到数据库表字段
	 *
	 *
	 *
	 *
	 *
	 *
	 *
	 *
	 *
	 *
	 *
	 *
	 */
	
	namespace App\Http\Controllers\Import;

	use App\Http\Controllers\Controller;
	use Illuminate\Http\Request;
	use App\Models\Import\mapExcelFileColumnHeaderToDatabaseTableFieldModel;

	class mapExcelFileColumnHeaderToDatabaseTableFieldController extends Controller
	{
		public function __construct()
		{
			# initialization default property
			# 
			# 
			$this->m_cHelper											= app()->gcHelper													;
			$this->m_mapExcelFileColumnHeaderToDatabaseTableFieldModel	= new mapExcelFileColumnHeaderToDatabaseTableFieldModel	($this)		;
		}

		/* 映射 excel 文件列头到数据库表字段
		 *
		 *
		 *
		 *
		 *
		 */
		public function mapExcelFileColumnHeaderToDatabaseTableField($clientID=0)
		{
			return $this->m_cHelper->gfApiEchoEx (
													$this->m_cHelper->gfJsonDecode	(
																						$this->m_cHelper->gfGetRequestBodyValue()
																						,
																						function($j) use($clientID) 
																						{
																							$j->appendProperty	(	[ 'client_id'	=> $clientID ]);			
																							$j->setDecodeStatus	(
																													$this->m_mapExcelFileColumnHeaderToDatabaseTableFieldModel->mapExcelFileColumnHeaderToDatabaseTableField($j)
																													,
																													'mapExcelFileColumnHeaderToDatabaseTableField.1000'
																													,
																													"映射 excel 文件列头到数据库表字段"
																												);
																						}
																						,
																						function($j)
																						{
																							$j->setDecodeStatusWithJsonError('mapExcelFileColumnHeaderToDatabaseTableField.2000','映射 excel 文件列头到数据库表字段');
																						}
																					)->getDecodeStatus()
												);
		}

		/* 法律案例表字段列表
		 *
		 *
		 *
		 *
		 */
		public function lawCaseTableFieldList()
		{
			return $this->m_cHelper->gfApiEchoEx (
													$this->m_cHelper->gfJsonDecode	(
																						$this->m_cHelper->gfGetRequestBodyValue()
																						,
																						function($j) 
																						{
																							$j->setDecodeStatus($this->m_mapExcelFileColumnHeaderToDatabaseTableFieldModel->lawCaseTableFieldList(),'lawCaseTableFieldList.1000',"法律案例表字段列表");
																						}
																						,
																						function($j)
																						{
																							$j->setDecodeStatusWithJsonError('lawCaseTableFieldList.2000','法律案例表字段列表');
																						}
																					)->getDecodeStatus()
												);
		}
		
		/* 获取 excel 文件列头与数据库字段之间的映射关系
		 *
		 *
		 *
		 *
		 */
		public function getMapRelationBetweenExcelFileColumnHeaderAndDatabaseField($clientID=0)
		{
			return $this->m_cHelper->gfApiEchoEx (
													$this->m_cHelper->gfJsonDecode	(
																						$this->m_cHelper->gfGetRequestBodyValue()
																						,
																						function($j) use($clientID) 
																						{
																							$j->appendProperty	(	[ 'client_id'	=> $clientID ]);
																							$j->setDecodeStatus($this->m_mapExcelFileColumnHeaderToDatabaseTableFieldModel->getMapRelationBetweenExcelFileColumnHeaderAndDatabaseField($j),'getMapRelationBetweenExcelFileColumnHeaderAndDatabaseField.1000',"获取 excel 文件列头与数据库字段之间的映射关系".'成功');
																						}
																						,
																						function($j)
																						{
																							$j->setDecodeStatusWithJsonError('getMapRelationBetweenExcelFileColumnHeaderAndDatabaseField.2000','获取 excel 文件列头与数据库字段之间的映射关系'.'错误');
																						}
																					)->getDecodeStatus()
												);
		}
	}
